package com.hp.order_service.feign;

import com.hp.order_service.entity.Goods;
import com.hp.order_service.fallback.GoodsFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "goods-service",fallback = GoodsFeignClientFallback.class)
public interface GoodsFeignClient {

    @RequestMapping("/goods/{id}")
    ResponseEntity<Goods> getGoodsById(@PathVariable Long id);

    @PostMapping("/goods")
    ResponseEntity<String> saveGoods(@RequestBody Goods goods);

    @PutMapping("/goods")
    ResponseEntity<String> updateGoods(@RequestBody Goods goods);

    @DeleteMapping("/goods/{id}")
    ResponseEntity<String> deleteGoods(@PathVariable Long id);

    @GetMapping("/goods")
    ResponseEntity<List<Goods>> getAllGoods();
}
